package org.example.services;

import org.example.domain.Discussion;
import org.example.domain.PageBean;
import org.example.domain.response.ResponseResult;

import javax.servlet.http.HttpServletRequest;

public interface DiscussionService {

    ResponseResult saveDiscussion(Discussion discussion);

    ResponseResult updateDiscussion(Discussion discussion);

    //添加flume
    ResponseResult userLikeDiscussion(int userId, int discussionId);

    //添加flume
    ResponseResult getDiscussionById(int discussionId, HttpServletRequest request);

    ResponseResult getDiscussionByPage(int pageSize, int currentPage);

    ResponseResult getDiscussionOrderByLikes(int currentPage);

    ResponseResult getDiscussionOrderByClick(int currentPage);

    ResponseResult getDiscussionByUserId(int userId, int currentPage);

    ResponseResult deleteDiscussionById(int discussionId);

    ResponseResult getDiscussionByTitle(String title, int currentPage);

    ResponseResult getDiscussionByType(String type, int currentPage);

    ResponseResult getDiscussionByCondition(Discussion discussion, int currentPage);

    ResponseResult getDiscussionByHot(int pageSize, int currentPage);

    ResponseResult getDiscussionByAdvice(int pageSize, int currentPage, int userId);

    void addCommentNumberAndContentAndUserAvatar(PageBean pageBean);

    /**
     * 使用es全局查询
     * @param key 查询关键字
     * @param pageSize 页大小
     * @param currentPage 当前页
     */
    ResponseResult getDiscussionByKey(String key, int pageSize, int currentPage);

    /**
     * 从数据库中更新讨论到ES中，通过讨论ID
     * @param discussionId 讨论ID
     */
    ResponseResult addDiscussionFromMysqlToESById(int discussionId);
}
